package io.sdl.common.sys.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.sdl.common.sys.dto.SdlSessionMessageDTO;
import io.sdl.common.sys.entity.SdlSessionMessageEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 会话聊天消息表
 * 
 * @author Dchen
 * @email 1211734836@qq.com
 * @date 2025-05-13 14:31:02
 */
@Mapper
public interface SdlSessionMessageDao extends BaseMapper<SdlSessionMessageEntity> {

    List<SdlSessionMessageEntity> findByRoomIdAndTimestampGreaterThan(String roomId, long since);

    //根据id查询相关的会话
    List<SdlSessionMessageEntity> getUserSessions(Long userId);


    //根据会话id获取历史消息
    List<SdlSessionMessageEntity> getHistoryMessages(@Param("sessionId") Long sessionId,@Param("page")Integer page ,@Param("pageSize")Integer pageSize);

    //用户作为接收人id去查询消息列表
    List<SdlSessionMessageDTO> getMsgList(Long receiverId);

    //消息已读
    Integer readMsg(@Param("receiverId")Long receiverId, @Param("senderId") Long senderId);

    Integer getUnreadMsg(@Param("receiverId")Long receiverId);

    List<SdlSessionMessageEntity> verificationCard(@Param("patientCard") String patientCard);
}
